<template>
  <el-row :gutter="20">
    <el-row>
      <navigator></navigator>
    </el-row>
    <h1>
      区块链教学示例系统
    </h1>
    <el-row>
      <el-table
          :data="contracts"
          style="width: 100%">
        <el-table-column
            prop="合约名称"
            label="合约名称"
            width="180">
        </el-table-column>
        <el-table-column
            prop="合约地址"
            label="合约地址"
            width="180">
        </el-table-column>
        <el-table-column
            prop="部署时间"
            label="部署时间">
        </el-table-column>
        <el-table-column
            prop="创建时间"
            label="创建时间">
        </el-table-column>
        <el-table-column
            prop="修改时间"
            label="修改时间">
        </el-table-column>
<!--        <el-table_column label="abi" width="100">-->
<!--          <template slot-scope="scope">-->
<!--            <el-button @click="handleClick(scope.row)" type="text" size="small">查看</el-button>-->
<!--          </template>-->

<!--        </el-table_column>-->
<!--        <el-table-column-->
<!--            prop="abi"-->
<!--            label="abi">-->
<!--        </el-table-column>-->
      </el-table>
<!--      {{contracts}}-->

    </el-row>

  </el-row>

</template>

<script>
import Navigator from "@/components/Navigator";
// import config from '@/config'
export default {
  name: "Home",
  components: {Navigator},
  data() {
    return {
      contracts:'',
      contract_abi:''
    }
  },
  created() {
    let token = this.$cookies.get('token')
    console.log(`***************  token is ${token}  **********************`)
    this.axios.get(`/user/token_verify?token=${token}`).then((response) => {
      // console.log(response.data)
      if (response.data.code != 200) {
        this.$router.push('/login')
      }
    }).catch((response) => {
      console.log(response.data)
      this.$router.push('/login')
    })

    this.axios.get(`contract/list?page=1`).then((response) => {
      if (response.data.code == 200) {
        this.contracts = response.data.data
      }
    })

  },
  methods: {
    handleClick(row){
      this.contract_abi = row.abi
    }
  }
}
</script>

<style scoped>

</style>